package iwpl.project.entities;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Customers entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "Customers")
public class Customers implements java.io.Serializable {

	// Fields

	private Integer id;
	private Apartments apartments;
	private String fullName;
	private Timestamp birthday;
	private String address;
	private String sex;
	private String phone;
	private String host;
	private Set<Vehicles> vehicleses = new HashSet<Vehicles>(0);

	// Constructors

	/** default constructor */
	public Customers() {
	}

	/** minimal constructor */
	public Customers(Integer id, String fullName, Timestamp birthday) {
		this.id = id;
		this.fullName = fullName;
		this.birthday = birthday;
	}

	/** full constructor */
	public Customers(Integer id, Apartments apartments, String fullName,
			Timestamp birthday, String address, String sex, String phone,
			String host, Set<Vehicles> vehicleses) {
		this.id = id;
		this.apartments = apartments;
		this.fullName = fullName;
		this.birthday = birthday;
		this.address = address;
		this.sex = sex;
		this.phone = phone;
		this.host = host;
		this.vehicleses = vehicleses;
	}

	// Property accessors
	@Id
	@GeneratedValue
	@Column(name = "ID", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ApartmentID")
	public Apartments getApartments() {
		return this.apartments;
	}

	public void setApartments(Apartments apartments) {
		this.apartments = apartments;
	}

	@Column(name = "FullName", nullable = false)
	public String getFullName() {
		return this.fullName;
	}

	public void setFullName(String fullName) {
		this.fullName = fullName;
	}

	@Column(name = "Birthday", nullable = false, length = 16)
	public Timestamp getBirthday() {
		return this.birthday;
	}

	public void setBirthday(Timestamp birthday) {
		this.birthday = birthday;
	}

	@Column(name = "Address")
	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(name = "Sex")
	public String getSex() {
		return this.sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	@Column(name = "Phone", length = 20)
	public String getPhone() {
		return this.phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@Column(name = "Host")
	public String getHost() {
		return this.host;
	}

	public void setHost(String host) {
		this.host = host;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "customers")
	public Set<Vehicles> getVehicleses() {
		return this.vehicleses;
	}

	public void setVehicleses(Set<Vehicles> vehicleses) {
		this.vehicleses = vehicleses;
	}

}